package com.example.springmvc.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2023/4/22 15:50
 */
@RestController
public class CalcController {
    @RequestMapping("/calc")
    public String sum(Integer num1,Integer num2){
        if (num1==null || num2 == null){
            return "<h1>不能对空值进行计算</h1> <a href = 'javascript:history.go(-1);' > 返回上一页 </a>";
        }
        return "<h1>计算结果是："+(num1+num2)+"</h1> <br>"+"<a href = 'javascript:history.go(-1);' > 返回上一页 </a>";
    }
}
